﻿
@{
    ViewData["Title"] = "操作日志";
    Layout = "~/Views/Shared/_Layout.cshtml";
}


@section Head{
    <link href="~/layuiadmin/style/style.css" rel="stylesheet" />

    <style>
        body{background:#fff !important;}
        .layui-table-cell span {
            font-size: 13px !important;
            font-weight: bold;
        }

        .layui-inline-secate {
            bottom: 8px;
        }

        .layui-table-tool-self {
            bottom: 8px;
        }
    </style>
}

<div id="dMain"  style="padding:10px;">
    <div class="wrapper-content">
        <div class="layui-card">
            <div class="layui-card-body">
                <table id="tabData" lay-filter="demo"></table>
            </div>
        </div>
    </div>
</div>

<script>
    window.onload = function () {
        layui.use('table', function () {
            var table = layui.table;

            table.render({
                elem: '#tabData',
                toolbar: '#toolbarDemo', //开启头部工具栏，并为其绑定左侧模板
                page: true,
                limit: 30,
                page: {
                    layout: ['prev', 'page', 'next', 'skip', 'count']
                },
                loading: true,
                cols: [
                    [ //表头
                        {
                            title: '#',
                            type: 'radio'
                        }, {
                            field: 'Depict',
                            title: '描述',
                            align: "center"
                        }, {
                            field: 'Modular',
                            title: '模块',
                            align: "center",
                            width: 100,
                            sort: true
                        }, {
                            field: 'IP',
                            title: 'IP',
                            width: 100,
                            sort: true,
                            align: "center"
                        }, {
                            field: 'Mechanism',
                            title: '机构',
                            width: 150,
                            sort: true,
                            aligin: "center"
                        }, {
                            field: 'Operator',
                            title: '操作人',
                            width: 100,
                            sort: true,
                            align: "center"
                        }, {
                            field: 'Operationtime',
                            title: '操作时间',
                            width: 180,
                            align: "center",
                            sort: true,
                        }
                    ]
                ],
                data: [{
                    "Depict": "操作了系统设置",
                    "Modular": "系统操作",
                    "IP": "127.0.0.1",
                    "Mechanism": "湖北省人民检察院",
                    "Operator": "管理员",
                    "Operationtime": "2019-12-20 09:03:51"
                },
                {
                    "Depict": "操作了系统设置",
                    "Modular": "系统操作",
                    "IP": "127.0.0.1",
                    "Mechanism": "湖北省人民检察院",
                    "Operator": "管理员",
                    "Operationtime": "2019-12-20 09:03:51"
                },
                {
                    "Depict": "操作了系统设置",
                    "Modular": "系统操作",
                    "IP": "127.0.0.1",
                    "Mechanism": "湖北省人民检察院",
                    "Operator": "管理员",
                    "Operationtime": "2019-12-20 09:03:51"
                },
                {
                    "Depict": "操作了系统设置",
                    "Modular": "系统操作",
                    "IP": "127.0.0.1",
                    "Mechanism": "湖北省人民检察院",
                    "Operator": "管理员",
                    "Operationtime": "2019-12-20 09:03:51"
                },
                {
                    "Depict": "操作了系统设置",
                    "Modular": "系统操作",
                    "IP": "127.0.0.1",
                    "Mechanism": "湖北省人民检察院",
                    "Operator": "管理员",
                    "Operationtime": "2019-12-20 09:03:51"
                },
                {
                    "Depict": "操作了系统设置",
                    "Modular": "系统操作",
                    "IP": "127.0.0.1",
                    "Mechanism": "湖北省人民检察院",
                    "Operator": "管理员",
                    "Operationtime": "2019-12-20 09:03:51"
                },
                {
                    "Depict": "操作了系统设置",
                    "Modular": "系统操作",
                    "IP": "127.0.0.1",
                    "Mechanism": "湖北省人民检察院",
                    "Operator": "管理员",
                    "Operationtime": "2019-12-20 09:03:51"
                },
                {
                    "Depict": "操作了系统设置",
                    "Modular": "系统操作",
                    "IP": "127.0.0.1",
                    "Mechanism": "湖北省人民检察院",
                    "Operator": "管理员",
                    "Operationtime": "2019-12-20 09:03:51"
                },
                {
                    "Depict": "操作了系统设置",
                    "Modular": "系统操作",
                    "IP": "127.0.0.1",
                    "Mechanism": "湖北省人民检察院",
                    "Operator": "管理员",
                    "Operationtime": "2019-12-20 09:03:51"
                },
                {
                    "Depict": "操作了系统设置",
                    "Modular": "系统操作",
                    "IP": "127.0.0.1",
                    "Mechanism": "湖北省人民检察院",
                    "Operator": "管理员",
                    "Operationtime": "2019-12-20 09:03:51"
                },
                {
                    "Depict": "操作了系统设置",
                    "Modular": "系统操作",
                    "IP": "127.0.0.1",
                    "Mechanism": "湖北省人民检察院",
                    "Operator": "管理员",
                    "Operationtime": "2019-12-20 09:03:51"
                }
                ]
            });
        });
    }
</script>


<script type="text/html" id="toolbarDemo">
    <div class="Log-title"></div>
    <div class="layui-inline layui-inline-secate">
        <input class="layui-input" name="id" id="test-table-demoReload" autocomplete="off" placeholder="搜索" data-type="reload">
    </div>
</script>

<script src="~/layuiadmin/layui/jquery.min.js"></script>
<script>
    $(document).on("click", ".layui-table-body table.layui-table tbody tr", function () {
        /*当单击表格行时,把单选按钮设为选中状态*/
        var tableDiv;
        var index = $(this).attr('data-index');
        var tableBox = $(this).parents('.layui-table-box');
        //存在固定列
        if (tableBox.find(".layui-table-fixed.layui-table-fixed-l").length > 0) {
            tableDiv = tableBox.find(".layui-table-fixed.layui-table-fixed-l");
        } else {
            tableDiv = tableBox.find(".layui-table-body.layui-table-main");
        }
        var checkCell = tableDiv.find("tr[data-index=" + index + "]").find("td div.layui-table-cell div.layui-form-radio I");
        if (checkCell.length > 0) {
            checkCell.click();
        }
    });
    //对td的单击事件进行拦截停止，防止事件冒泡再次触发上述的单击事件  将此代码在页面初始化后执行一次即可以。
    $(document).on("click", "td div.layui-table-cell div.layui-form-radio", function (e) {
        e.stopPropagation();
    });
</script>